package acwing.哈希;

import com.sun.xml.internal.bind.v2.model.core.ID;

import java.io.BufferedInputStream;
import java.util.Arrays;
import java.util.Scanner;

/**
 * 模拟散列表
 *
 * @author yang
 * @date 2021/11/23
 */
public class 模拟散列表 {

    // 拉链法

    /*static int N = 100003;
    static int[]h = new int[N], e = new int[N], ne = new int[N];
    static int idx = 0;

    public static void insert(int a) {
        int k = (a % N + N) % N; // 处理a是负数的情况
        e[idx] = a;
        ne[idx] = h[k];
        h[k] = idx++;
    }
    public static boolean query(int a) {
        boolean flag = false;
        int k = (a % N + N) % N;
        for (int i = h[k]; i != -1; i = ne[i]) {
            if (e[i] == a) flag = true;
        }
        return flag;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(new BufferedInputStream(System.in));
        int n  = in.nextInt();
        Arrays.fill(h, -1);
        while (n-- != 0) {
            String s = in.next();
            if (s.equals("I")) {
                int a = in.nextInt();
                insert(a);
            } else {
                int a = in.nextInt();
                if (query(a)) System.out.println("Yes");
                else System.out.println("No");
            }
        }
    }*/

    //
    private static final int N = 200003, index = Integer.MAX_VALUE;
    private static int[] h = new int[N];

    public static void insert(int a) {
        int k = find(a);
        while (h[k] == index) {
            h[k] = a;
            break;
        }
    }

    public static int find(int a) {
        int idx = 0;
        int k = (a % N + N) % N;
        while (h[k] != index && h[k] != a) {
            k++;
            if (k == N) k = 0; // 从头开始找
        }
        return k; // 要不返回的是要插入位置的值，要不是就是找到了这个值
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(new BufferedInputStream(System.in));
        int n = in.nextInt();
        Arrays.fill(h, Integer.MAX_VALUE);
        while (n-- != 0) {
            String s = in.next();
            if (s.equals("I")) {
                int a = in.nextInt();
                insert(a);
            } else {
                int a = in.nextInt();
                if (h[find(a)] == a) System.out.println("Yes");
                else System.out.println("No");
            }
        }
    }
}
